define(function(require, exports, module) {

  // var Backbone = require('backbone');
  var $ = require('jquery');
  var _ = require('underscore');
  // var jsonview = require('jsonview');
  var tmpl = require('text!../tmpl.html');

  function main() {
    var $app = $('<div id="app">');
    $('#main').html($app);

    $app.append(tmpl);

    // Base object constructor function
    function base(spec) {
      var that = {}; // Create an empty object
      that.name = spec.name; // Add it a "name" property
      return that; // Return the object
    }

    // Construct a child object, inheriting from "base"
    function child(spec) {
      var that = base(spec); // Create the object through the "base" constructor
      that.sayHello = function() { // Augment that object
        return 'Hello, I\'m ' + that.name;
      };
      return that; // Return it
    }


    function executeCallback(f) {
      result.textContent = f();
    }

    var object = child({ name: 'a functional object' });
    executeCallback(object.sayHello); // Pass the method "sayHello" as a callback


    function a() {
      return new b();
    }

    a.prototype = {
      sayHello: function() {
        console.log('hello a');
      }
    }

    function b() {
      this.props = {}
    }

    b.prototype = {
      constructor: b,
      sayHello: function() {
        console.log('hello b');
      }
    }

    var aInstance = new a();
    aInstance.sayHello()
  }

  return main;
})
